
import 'package:favourcate/core/model/meal_model.dart';
import 'package:favourcate/core/services/http_request.dart';

class GLMealRequest {
  static Future<List<GLMealModel>> getMealData() async {
    // 1. 发送网络请求
    const url = '/meal';
    final result = await HttpRequest.request(url);
    // 2. json 转 model
    final mealArray = result['meal'];
    List<GLMealModel> meals = [];
    for (var json in mealArray) {
      meals.add(GLMealModel.fromJson(json));
    }
    return meals;
  }
}